package cn.zn.modules.pz.cur.controller;

import cn.hutool.core.collection.CollUtil;
import cn.zn.framework.common.utils.PageUtils;
import cn.zn.framework.common.utils.R;
import cn.zn.modules.zzsys.inter.TeacherInter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("pz/cur/pzteacher")
public class TpTeacherController {
    @Autowired
    private TeacherInter teacherInter;

    @GetMapping
    public R page(@RequestParam Map<String, Object> params) {
        if (teacherInter == null) {
            return R.error("未加载教师模块");
        }
        if (!params.containsKey("search") || params.get("search").toString().equals("")) {
            return R.ok().put("page", new PageUtils(CollUtil.newArrayList(), 0, 10, 1));
        }
        return R.ok().put("page", teacherInter.queryPage(params));
    }
}
